package com.lvcoding.sec3.secdemo3.validatecode.parent;

import org.springframework.web.context.request.ServletWebRequest;

/**
 * 校验码处理器，封装不同校验码的处理逻辑
 */
public interface ValidateCodeProcessor {

    /**
     * 验证码放入session的前缀
     */
    String SESSION_KEY_PREFIX = "SESSION_KEY_FOR_CODE_";

    /**
     * 创建校验码
     * @param request
     * @throws Exception
     */
    void create(ServletWebRequest request) throws Exception;


    /**
     * 保存校验码
     * @param request
     * @param code
     * @throws Exception
     */
    void save(ServletWebRequest request, Object code) throws Exception;


    /**
     * 生成校验码
     * @param request
     * @throws Exception
     */
    Object generate(ServletWebRequest request) throws Exception;


//    void send(ServletWebRequest request, Object validateCode) throws Exception;
}
